<template>
  <div class="itemMusicList">
    <div class="top">
      <div class="left">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-muqin"></use>
        </svg>
        <span>共{{ itemList.length }}首</span>
      </div>
      <div class="right">
        <svg class="icon" aria-hidden="true">
          <use xlink:href="#icon-jimu"></use>
        </svg>
        <span>待开发</span>
      </div>
    </div>
    <div class="musicList">
      <div class="item" v-for="(item, i) in itemList" :key="i">
        <div class="itemLeft" @click="playMusic(i)">
          <span class="leftSpan">{{ i + 1 }}</span>
          <div>
            <p>{{ item.name }}</p>
            <span v-for="(item1, index) in item.ar" :key="index">{{
              item1.name
            }}</span>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { mapMutations } from "vuex";

export default {
  setup(props) {
    console.log(props);
  },
  props: ["itemList"],
  methods: {
    playMusic: function (i) {
      this.updataPlayList(this.itemList);
      this.updataPlayListIndex(i);
    },
    ...mapMutations(["updataPlayList", "updataPlayListIndex"]),
  },
};
</script>
<style lang="less">
.itemMusicList {
  .musicList {
    width: 100%;
    div {
      p {
        width: 4.54rem;
        height: 0.4rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-weight: 700;
      }
      span {
        font-weight: 400;
        font-size: 0.24rem;
        color: #999;
      }
      margin-left: 0.2rem;
    }
    .item {
      width: 100%;
      height: 1.4rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .itemLeft {
      width: 85%;
      height: 100%;
      display: flex;
      align-items: center;
      .leftSpan {
        display: inline-block;
        width: 0.2rem;
        text-align: center;
        font-size: 0.3rem;
      }
    }
  }
}
.top {
  height: 1rem;
  margin-top: 0.2rem;
  display: flex;
  justify-content: space-around;
  width: 100%;
  .left,
  .right {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .icon {
    height: 0.6rem;
    width: 0.6rem;
  }
}
</style>
